-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CB-12035 (android) Fix bug [cordova-plugin-network-information] connection info is not reliable on Android 6 #74
Conversation
Hello, Can someone point me in the right direction why the build is failing. Kind regards, |
You can ignore the The other one was stalled, I restarted it. Let's see if this fixes it. |
Ok, failed again. The error message indicates that this is connnected to apache/cordova-cli#339, which is currently actively being worked on. Expect a CLI 8.1.1 release that will fix the issue. |
I triggered a new build. (I did change some logging for a new commit). |
@janpio Hey Jan, should I do anything more for this pull request (request a review, merge, ...)? Or do I leave it like it is. |
No, for now there is not really anything you can do - someone will have to come along and review it. (I'm currently working on fixing test failures across all plugin PRs, so I am more than busy - and also don't know much about Android) You could of course spend some time reviewing and commenting on other PRs of this plugin or others - that might get you some karma 💃 |
Is anyone able to merge this? |
Did you test the change? Did it work? No side effects on older versions of Android? |
I tested this on my Android 5 device, didn't work. I only tested this PR version because that's what I'm using in my prod app, so I'm not sure if it's these changes specifically that prevent it from working. |
@terpro what is not working? Can you give some reproduction steps for the Android 5 device? Is the connection reported falsy as 'none'? |
I don't have time to do extensive testing, but the online and offline events weren't being called |
Just to be sure. Is it working with the master version of the cordova-plugin-network-information? In production code, we do not rely on the online and offline events, we always read the: In my opinion this behaviour is not changed with this pull request. |
I just tested both the master and the pr on my Android 5.1 device. navigator.connection.type works as expected in both cases. However, the online and offline events are not called in this pr, but are in master. |
I just stumbled on this one: https://stackoverflow.com/questions/29677852/connectivitymanager-extra-no-connectivity-is-always-false-on-android-lollipop |
@terpro end @joewoodhouse feel free to test it again. I rewrote it to use a networkCallback as suggested in the android documentation. |
Back to the drawing table. Tests on my Oreo and LG are not successfull. |
(I added |
@PieterVanPoyer The changes you made originally fixed the issue for Android 6+ devices, but broke anything below 6. Is it possible to just add an API level/Android version check and use the old or new code based on that? |
…roke anything below 6. API level/Android version check added.
@terpro I followed your suggestion and introduced the Android Sdk version in the algorithm. So in case the sdk is below M - android the old behaviour is done. |
@janpio @PieterVanPoyer Tested and working as expected on Android 5, 7, 8, 9, looks ready to merge |
Great testing! |
version is managed out of PRs in the release process. |
Hey @janpio can it be merged? Who can merge it? |
Please leave an "Approve" review on the PR @terpro. In general someone has to come, understand and read through your PR @PieterVanPoyer, test and approve it, then merge. Later someone has to create a release of the plugin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working as expected on Android 5, 7, 8, 9
Jow, Some Github users did already fork my repo, to make use of this fix. Kind regards, |
@janpio Hello, is there a chance that this pull request will be merged? That would be awesome as it's a really annoying bug that will be fixed by this PR. Thanks in advance! |
+1 that this PR should be merged! |
any update about this PR? |
knock knock ... Can you tell when someone gets to it and approve it? |
+1 on please can this PR be merged in. |
I suggest you guys send this kind of request to [email protected]
…On Mon, Apr 1, 2019, 6:00 AM JamboBuenna ***@***.***> wrote:
+1 on please can this PR be merged in.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#74 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABfNUOp3tLrGEjgjvvTdzY4NuzEqGUveks5vcdi2gaJpZM4W7f-L>
.
|
Since the PR has been merged, does anybody know if its going to be a release in the next days/weeks? 🙏 |
I recommend you send this kind of a request to: [email protected] And keep in mind that Cordova is run by a bunch of hard-working volunteers. |
Thanks @brodybits for the reply and the cordova community for your incredible work 👏 |
https://issues.apache.org/jira/browse/CB-12035 && #64: in case of TYPE_NONE (android bug?) return TYPE_UNKNOWN if ConnectivityManager.EXTRA_NO_CONNECTIVITY from the intent return false.
Platforms affected
android (6+)
What does this PR do?
For android M and above (6+) I check the EXTRA_NO_CONNECTIVITY flag. (https://developer.android.com/reference/android/net/ConnectivityManager.html#EXTRA_NO_CONNECTIVITY)
If the EXTRA_NO_CONNECTION flag still returns false, the connectionType is set to UNKNOWN.
This workaround dit not work for Lollipop androids. So the correction is only done for 6+ Androids.
What testing has been done on this change?
Thoroughly testing on my Samsung device (Oreo) and a Lollipop LG.
Checklist